package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.entity.autocode.ZlProjectModule;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleAddDTO;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleDelDTO;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleEditDTO;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleQueryDTO;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleDetailDTO;
import com.my.zl.console.dto.autocode.projectModule.ReqProjectModuleStateDTO;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleAddDTO;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleDelDTO;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleEditDTO;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleQueryDTO;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleDetailDTO;
import com.my.zl.console.service.autocode.IProjectModuleService;
import com.my.zl.console.dto.autocode.projectModule.ResProjectModuleStateDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 项目模块配置
 * @author ZL
 */
@Api(value="项目模块配置",tags ="项目模块配置")
@RestController
@RequestMapping("/api/autocode/projectModule")
public class ProjectModuleController extends BaseController {

    @Autowired
    private IProjectModuleService projectModuleService;
    
    /**
     * 查询
     */
    @ApiOperation(value="项目模块配置-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResProjectModuleQueryDTO> listProjectModule(ReqProjectModuleQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResProjectModuleQueryDTO data = projectModuleService.queryProjectModuleList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="项目模块配置-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResProjectModuleDetailDTO> detailProjectModule(ReqProjectModuleDetailDTO reqInfo) throws Exception{
        ResProjectModuleDetailDTO data = projectModuleService.queryProjectModuleDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="项目模块配置-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResProjectModuleAddDTO> addProjectModule(@RequestBody ReqDTO<ReqProjectModuleAddDTO> reqInfo) throws Exception{
        ResProjectModuleAddDTO data = projectModuleService.insertProjectModuleInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="项目模块配置-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResProjectModuleEditDTO> editProjectModule(@RequestBody ReqDTO<ReqProjectModuleEditDTO> reqInfo) throws Exception{
        ResProjectModuleEditDTO data = projectModuleService.updateProjectModuleInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="项目模块配置-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResProjectModuleDelDTO> delProjectModule(@RequestBody ReqDTO<ReqProjectModuleDelDTO> reqInfo) throws Exception{
        ResProjectModuleDelDTO data = projectModuleService.deleteProjectModuleInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="项目模块配置-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResProjectModuleStateDTO> stateProjectModule(@RequestBody ReqDTO<ReqProjectModuleStateDTO> reqInfo) throws Exception{
        ResProjectModuleStateDTO data = projectModuleService.updateProjectModuleState(reqInfo);
        return successDATA(data); 
    }
    
    
}